#include <iostream>
#include <math.h>
#include <limits>
#include <cmath>

namespace
{
	int get_random_int(int inf, int sup) // from [inf; sup]
	{
		return inf + std::abs(rand()) % (sup - inf + 1);
	}

	double get_random_double() // from [0; 1)
	{
		return static_cast<double>(get_random_int(0, std::numeric_limits<int>::max() - 1)) / (std::numeric_limits<int>::max());
	}

	const double double_eps = std::numeric_limits<double>::epsilon();
}

int main()
{
	const std::size_t test_size = 4;
	const std::size_t inner_test_size = test_size * 7;
	int n = test_size * inner_test_size + 3;
	std::cout << n << "\n0\n";
	std::cout.precision(17);
	std::cout << std::scientific;
	double pow2_500 = std::pow(2., 500);
	double pow2_499 = std::pow(2., 499);

	std::cout << 1 << " " << 1 + double_eps << " " << pow2_500 << " " << pow2_500 << "\n";
	std::cout << pow2_500 << " " << 1 << " " << pow2_499 << " " << pow2_499 << "\n";

	std::cout << 1 << " " << 1 - double_eps << " " << pow2_500 << " " << pow2_500 << "\n";
	std::cout << pow2_500 << " " << 1 << " " << pow2_499 << " " << pow2_499 << "\n";

	std::cout << 1 << " " << 1 << " " << pow2_500 << " " << pow2_500 << "\n";
	std::cout << pow2_500 << " " << 1 << " " << pow2_499 << " " << pow2_499 << "\n";

	for (int j = 0; j != test_size; j++)
	{
		double d1, d2;
		double left[inner_test_size];
		double right[inner_test_size];
		double * y1 = &d1;
		long long * long_y1 = reinterpret_cast<long long *>(y1);
		*y1 = (get_random_double()) * std::pow(2., get_random_int(-128, 128));
		double x1 = (get_random_double() - 2) * std::pow(2., get_random_int(-128, 128));
		double * y2 = &d2;
		long long * long_y2 = reinterpret_cast<long long *>(y2);
		*y2 = (get_random_double()) * std::pow(2., get_random_int(-128, 128));
		double x2 = (get_random_double() + 1) * std::pow(2., get_random_int(-128, 128));
		for (std::size_t i = 0; i != inner_test_size; ++i)
		{
			*long_y1 += 1;
			*long_y2 += 1;
			left[i] = *y1;
			right[i] = *y2;
		}
		for (std::size_t i = 0; i != inner_test_size; ++i)
		{
			int a = get_random_int(0, inner_test_size - 1);
			int b = get_random_int(0, inner_test_size - 1);
			int c = get_random_int(0, inner_test_size - 1);
			int d = get_random_int(0, inner_test_size - 1);
			std::cout << x1 << " " << left[a] << " " << x2 << " " << right[b] << "\n";
			std::cout << x1 << " " << left[c] << " " << x2 << " " << right[d] << "\n"; 
		}
	}

	return 0;
}